package cn.itcast.oa.service.impl;

import java.io.File;

import org.springframework.stereotype.Service;

import cn.itcast.oa.base.BaseDAOimpl;
import cn.itcast.oa.model.ApplicationTemplate;
import cn.itcast.oa.service.ApplicationTemplateService;

@Service
public class ApplicationTemplateServiceImpl extends BaseDAOimpl<ApplicationTemplate> implements ApplicationTemplateService {
    
	@Override
	/**
	 * 重写删除方法
	 */
	public void delete(Long id){
    	 ApplicationTemplate applicationTemplate=getById(id);
    	 getSession().delete(applicationTemplate);//保存application到数据库
    	 
    	 //删除已经存放的文件
    	 File file=new File(applicationTemplate.getPath());
    	 if(file.exists()){
    	      file.delete();
    	 }
    }
}
